<cfcomponent displayname="CrafterGenericDocument" extends="crafter.CrafterDocument" accessors="yes" output="no">

	
	<!--- getValue() --->
	<cffunction name="getValue" access="public" output="no" returntype="string" hint="">
		<cfargument name="xpath" type="string" required="yes" />
		<cfscript>
			if (NOT FindNoCase("value",ListLast(arguments.xpath,"/"))){
				local.xPath = arguments.xpath & "/value";	
			}
			return super.getValue(local.xPath);
		</cfscript>
	</cffunction>
	
	
	<!--- getValueByItemCode() --->
	<cffunction name="getValueByItemCode" access="public" output="no" returntype="string" hint="">
		<cfargument name="code" type="string" required="yes" />
		<cfscript>
			local.xPath = "//item[code='#arguments.code#']/value";
			return super.getValue(local.xPath);
		</cfscript>
	</cffunction>
	
	
	<!--- getValueAsTextObject() --->
	<cffunction name="getValueAsTextObject" access="public" output="no" returntype="crafter.CrafterText" hint="">
		<cfargument name="xpath" type="string" required="yes" />
		<cfscript>
			// Create text object, load it with the text value from getValue(), and return.
			local.oText = CreateObject("component","crafter.CrafterText").init(
				text = getValue(arguments.xpath)
			);
			return local.oText;
		</cfscript>
	</cffunction>
	
	
	<!--- getValueAsTextObjectByItemCode() --->
	<cffunction name="getValueAsTextObjectByItemCode" access="public" output="no" returntype="crafter.CrafterText" hint="">
		<cfargument name="code" type="string" required="yes" />
		<cfscript>
			// Create text object, load it with the text value from getValue(), and return.
			local.oText = CreateObject("component","crafter.CrafterText").init(
				text = getValueByItemCode(arguments.code)
			);
			return local.oText;
		</cfscript>
	</cffunction>
	
	
</cfcomponent>